package com.ysw.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @ClassName User
 * @Description TODO
 * @Author ysw
 * @Date 2021/11/13 15:31
 */
@Data
@TableName("user")
public class User {
    // 主键
    // 如果没有指定，会自动使用ID_WORKER 生成策略
    // 如果是自动增长的话需要手动改一下生成策略
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer age;
    private Integer version;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateDate;

    public User(String name, Integer age, Integer version, LocalDateTime createDate, Date updateDate) {
        this.name = name;
        this.age = age;
        this.version = version;
        this.createDate = createDate;
        this.updateDate = updateDate;
    }
    public User(){};
}